<template>
  <body>
<img src="../assets/night.jpg" class="body1">
<div id="login_box">
  <h2>LOGIN</h2>
  <div id="input_box">
    <input id=id type="text" class="input-1" v-model="account" placeholder="请输入账号">
  </div>
  <div class="input_box">
    <input id=pwd type="password" class="input-1" v-model="password " placeholder="请输入密码">
  </div>
  <button class="button-login" @click="login">登录</button>--><br>
  <button class="button-login" @click="redirect">注册</button>--><br>
</div>
  </body>
</template>

<script>

import request from "@/utils/request";
import router from "@/router";
import res from "core-js/internals/is-forced";

export default {
  name: "UserLogin",
  data() {
    return {
      account: '',
      password: ''
    }
  },
  methods: {
    login() {
      request.post("http://localhost:8082/user/login?account="+this.account+"&password="+this.password).then(res =>{
        if(res.flag){
          localStorage.setItem("userToken",res.data)
          router.push({path: '/userCenter/userWelcome'});
          this.$message({
            type: 'success',
            message: res.msg
          })
        }else {
          this.$message.error(res.msg)
          this.account = ''
          this.password = ''
        }
      })
    },
    redirect() {
      router.push({path: '/regiest'});
    }
  }
}
</script>

<style>
.t11 {
  position: absolute;
  margin-left: 31%;
  top: 100px;
}

.c12 {
  /* display: inline-flex; */
  position: absolute;
  top: 300px;
  margin-left: 35%;
  text-align: center;
  font-family: fantasy;
}

.c13 {
  /* display: inline-flex; */
  position: absolute;
  top: 360px;
  margin-left: 35%;
  text-align: center;
  font-family: fantasy;
}

.c14 {
  position: absolute;
  margin-left: 39%;
  top: 410px;
  width: 260px;
  height: 35px;
  background-image: url(../assets/button-bg.jpg);
  border-radius: 5px;
  font-size: 20px;
}

.c15 {
  position: absolute;
  margin-left: 39%;
  top: 460px;
  width: 260px;
  height: 35px;
  background-image: url(../assets/button-bg.jpg);
  border-radius: 5px;
  font-size: 20px;
}

.class6 {
  text-align: center;
}

.text1 {
  height: 25px;
  width: 300px;
}

#pic {
  position: relative;
  background-repeat: no-repeat;
  width: 1500px;
  height: 1000px;
  z-index: -1;
}
.error{
  color: red;
}
img{
  width: 400px;
  height: 400px;
  border: 1px solid red;
}
.body1 {
  position: absolute;
  width:130%;
  height:auto;
  max-width:130%;
  max-height:100%;
  z-index: -1;
}

#login_box {
  position: absolute;
  width: 20%;
  height: 400px;
  background-color: #00000060;
  margin-top: 10%;
  margin-left: 36%;
  text-align: center;
  border-radius: 10px;
  padding: 50px 50px;
}

h2 {
  color: #ffffff90;
  margin-top: 5%;
}

#input-box {
  margin-top: 5%;
}

.input-1 {
  border: 0;
  width: 60%;
  font-size: 15px;
  color: #fff;
  background: transparent;
  border-bottom: 2px solid #fff;
  padding: 5px 10px;
  outline: none;
  margin-top: 10px;
}

.button-login {
  margin-top: 50px;
  width: 60%;
  height: 30px;
  border-radius: 10px;
  border: 0;
  color: #fff;
  text-align: center;
  line-height: 30px;
  font-size: 15px;
  background-image: linear-gradient(to right, #30cfd0, #330867);
}

#sign_up {
  margin-top: 45%;
  margin-left: 60%;
}

</style>
